package by.ad.filter;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.Filter;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;

public abstract class ParametrizedFilter
  implements Filter
{
  @Override
  public void init(final FilterConfig filterConfig)
    throws ServletException
  {
    @SuppressWarnings("unchecked")
    final Enumeration<Object> params = filterConfig.getInitParameterNames();
    while (params.hasMoreElements()) {
      final String name = (String) params.nextElement();
      final String value = filterConfig.getInitParameter(name);
      this.params.put(name, value);
    }
  }

  @Override
  public void destroy() {}

  protected final Map<String, String> params = new HashMap<String, String>();
}
